package com.portal.framework.common;

public class PageBean {
	private int pageSize=20;
	
	private int currentPage=1;
	
	private int startRow=0;
	
	private boolean hasPreviewPage=false;
	
	private boolean hasNextPage=false;
	
	private int total=0;
	
	private int totalPage=0;

	/**
	 * @return the pageSize
	 */
	public int getPageSize() {
		return pageSize;
	}

	/**
	 * @param pageSize the pageSize to set
	 */
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;		
	}

	/**
	 * @return the currentPage
	 */
	public int getCurrentPage() {
		return currentPage;
	}

	/**
	 * @param currentPage the currentPage to set
	 */
	public void setCurrentPage(int currentPage) {	
		this.currentPage=currentPage;
	}

	/**
	 * @return the startRow
	 */
	public int getStartRow() {
		return startRow;
	}

	/**
	 * @param startRow the startRow to set
	 */
	public void setStartRow(int startRow) {
		this.startRow = startRow;
	}

	/**
	 * @return the hasPreviewPage
	 */
	public boolean isHasPreviewPage() {
		return hasPreviewPage;
	}

	/**
	 * @param hasPreviewPage the hasPreviewPage to set
	 */
	public void setHasPreviewPage(boolean hasPreviewPage) {
		this.hasPreviewPage = hasPreviewPage;
	}

	/**
	 * @return the hasNextPage
	 */
	public boolean isHasNextPage() {
		return hasNextPage;
	}

	/**
	 * @param hasNextPage the hasNextPage to set
	 */
	public void setHasNextPage(boolean hasNextPage) {
		this.hasNextPage = hasNextPage;
	}

	/**
	 * @return the totalRecord
	 */
	public int getTotal() {
		return total;
	}

	/**
	 * @param totalRecord the totalRecord to set
	 */
	public void setTotal(int total) {
		this.total = total;
		totalPage=(total+pageSize-1)/pageSize;
		startRow=(currentPage-1)*pageSize;
		if(currentPage<=1)
		{
			currentPage=1;
			hasPreviewPage=false;
		}
		else
		{
			hasPreviewPage=true;
		}
		if(currentPage>=totalPage)
		{
			hasNextPage=false;
		}
		else
		{
			hasNextPage=true;
		}
	}

	/**
	 * @return the totalPage
	 */
	public int getTotalPage() {
		return totalPage;
	}

	/**
	 * @param totalPage the totalPage to set
	 */
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	
	
}
